package struct.intermediate.tree;

import java.util.Random;

/**
 * @author MAX
 * @version 1.0
 * @description TODO
 * @date 2022/1/14 17:01
 */
public class BinarySearchTreeTest {

    public static void main(String[] args) {
        BinarySearchTree<Integer> bst = new BinarySearchTree<>();

        int n = 10000000;
        Random random = new Random();

        long startTime = System.nanoTime();
        for (int i = 0; i < n; i++) {
            bst.add(random.nextInt(Integer.MAX_VALUE));
        }

        System.out.println(bst.contains(random.nextInt(Integer.MAX_VALUE)));

        long endTime = System.nanoTime();
        double time = (endTime - startTime) / 1000000000.0;
        System.out.println("bst cost time: " + time  + "s");
        /*bst.preOrder();
        bst.middleOrder();
        bst.postOrder();*/
    }
}
